package cn.com.demo.i18n.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider;
@Slf4j
@Configuration
public class AsyncExecutorConfig {
    @Value("${async.threads:2}")
    Integer asyncThreads = 2;
    @Bean
    public Executor myExecutor(){
        return new ThreadPoolExecutor(asyncThreads, asyncThreads,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>());
    }
}
